package com.rolfhoward.video.record.widget

import android.content.Context
import android.util.AttributeSet
import android.view.MotionEvent
import android.widget.RelativeLayout

/**
 *@author wuqiubin
 *@date 2023/2/1
 *@Describe Touch事件处理View
 */
class TranslateTouchView:  RelativeLayout{

    private var listener: OnTranslateTouchListener? = null
    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )

    override fun onTouchEvent(event: MotionEvent?): Boolean {
        listener?.touchTrans()
        return super.onTouchEvent(event)
    }

    fun setOnTranslateTouchListener(listener: OnTranslateTouchListener) {
        this.listener = listener
    }

    interface OnTranslateTouchListener {
        fun touchTrans()
    }
}